# -*- coding: UTF-8 -*-

from abaqus import *
from abaqusConstants import *
import regionToolset

def tiquUF(U,F,data_name):

    xy1 = session.xyDataObjects['U2 PI: RIGIDPLATE-1 N: 1 NSET RF-TOPPLATE-1']
    xy2 = session.xyDataObjects['RF2 PI: RIGIDPLATE-1 N: 1 NSET RF-TOPPLATE-1']
    xy3 = combine(abs(xy1/U), abs(xy2/F))
    xy3.setValues(
        sourceDescription='combine ( abs ( "U2 PI: RIGIDPLATE-1 N: 1 NSET RF-TOPPLATE-1"/'+ str(U) + ') ,abs ( "RF2 PI: RIGIDPLATE-1 N: 1 NSET RF-TOPPLATE-1"/' + str(F) +'))')
    tmpName = xy3.name
    UF_NDname = data_name + '-ND'
    session.xyDataObjects.changeKey(tmpName, UF_NDname)


    xy1 = session.xyDataObjects[UF_NDname]
    xy2 = butterworthFilter(xyData=xy1, cutoffFrequency=30)
    xy2.setValues(
        sourceDescription='butterworthFilter ( xyData= ' + UF_NDname +' , cutoffFrequency=30 )')
    tmpName = xy2.name
    session.xyDataObjects.changeKey(tmpName, data_name + '-ND-filter30')